Learn R Programming

SpatialNP (version 1.1-5)

Spatial location: Multivariate location estimates based on spatial signs and signed ranks

Description

Iterative algorithms to find spatial median, multivariate Hodges-Lehmann estimate of location, their affine equivariant versions and k-step versions of these.

Usage

spatial.location(X, score = c("sign", "signrank"), init = NULL, 
shape = TRUE, steps = Inf, maxiter = 500, eps = 1e-6, 
na.action = na.fail) 

ae.spatial.median(X, init = NULL, shape = TRUE, steps = Inf, maxiter = 500, eps = 1e-6, na.action = na.fail)

ae.hl.estimate(X, init = NULL, shape = TRUE, steps = Inf, maxiter = 500, eps = 1e-06, na.action = na.fail)

Arguments

X

a matrix or a data frame

score

a character string indicating which transformation of the observations should be used

init

an optional vector giving the initial point of the iteration

shape

logical, or a matrix. See details

steps

fixed number of iteration steps to take, if Inf iteration is repeated until convergence (or until maxiter steps)

eps

tolerance for convergence

maxiter

maximum number of iteration steps

na.action

a function which indicates what should happen when the data contain 'NA's. Default is to fail.

Value

The estimate vector with the (final estimate of or given) shape matrix as attribute "shape".

Details

Spatial median and Hodges-Lehmann estimator (spatial median of the pairwise differences) are not affine equivariant. Affine equivariance can be achieved by simultaneously estimating the corresponding shape, as proposed for the spatial median by Hettmansperger and Randles (2002). For spatial median the corresponding shape is signs.shape and for the Hodges-Lehmann estimate it is signrank.shape.

spatial.location is a wrapper function for a unified access to both location estimates. The choice of estimate is done via score:

  • "sign" for spatial median

  • "signrank" for Hodges-Lehmann estimate

If a matrix (must be symmetric and positive definite, but this is not checked) is given as shape the location estimate is found with respect to that shape and no further shape estimation is done. If a logical TRUE is given as shape the shape is estimated and consequently the affine equivariant version of the location estimate is found. If shape is FALSE then shape estimation is not done and the non affine equivariant versions of the location estimate, that is the spatial median and the Hodges-Lehmann estimate are found.

References

Hettmansperger, T. and Randles, R. (2002) A Practical Affine Equivariant Multivariate Median, Biometrika, 89, pp. 851-860

See Also

spatial.median, signrank.shape

Examples

Run this code
# NOT RUN {
A<-matrix(c(1,2,-3,4,3,-2,-1,0,4),ncol=3)
X<-matrix(rnorm(3000),ncol=3)%*%t(A)
spatial.location(X,score="signrank")
spatial.location(X,score="sign")
#compare with:
colMeans(X)
ae.hl.estimate(X,shape=A%*%t(A))
ae.hl.estimate(X,shape=FALSE)
# }

Run the code above in your browser using DataLab